3.157 \(\int (d x)^{-1+n} \log ^2(c x^n) \, dx\)

Optimal. Leaf size=53 \[ \frac{(d x)^n \log ^2\left (c x^n\right )}{d n}-\frac{2 (d x)^n \log \left (c x^n\right )}{d n}+\frac{2 (d x)^n}{d n} \]

[Out]

(2*(d*x)^n)/(d*n) - (2*(d*x)^n*Log[c*x^n])/(d*n) + ((d*x)^n*Log[c*x^n]^2)/(d*n)

________________________________________________________________________________________

Rubi [A]  time = 0.031621, antiderivative size = 53, normalized size of antiderivative = 1., number of steps used = 2, number of rules used = 2, integrand size = 16, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.125, Rules used = {2305, 2304} \[ \frac{(d x)^n \log ^2\left (c x^n\right )}{d n}-\frac{2 (d x)^n \log \left (c x^n\right )}{d n}+\frac{2 (d x)^n}{d n} \]

Antiderivative was successfully verified.

[In]

Int[(d*x)^(-1 + n)*Log[c*x^n]^2,x]

[Out]

(2*(d*x)^n)/(d*n) - (2*(d*x)^n*Log[c*x^n])/(d*n) + ((d*x)^n*Log[c*x^n]^2)/(d*n)

Rule 2305

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)*((d_.)*(x_))^(m_.), x_Symbol] :> Simp[((d*x)^(m + 1)*(a + b*Lo
g[c*x^n])^p)/(d*(m + 1)), x] - Dist[(b*n*p)/(m + 1), Int[(d*x)^m*(a + b*Log[c*x^n])^(p - 1), x], x] /; FreeQ[{
a, b, c, d, m, n}, x] && NeQ[m, -1] && GtQ[p, 0]

Rule 2304

Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))*((d_.)*(x_))^(m_.), x_Symbol] :> Simp[((d*x)^(m + 1)*(a + b*Log[c*x^
n]))/(d*(m + 1)), x] - Simp[(b*n*(d*x)^(m + 1))/(d*(m + 1)^2), x] /; FreeQ[{a, b, c, d, m, n}, x] && NeQ[m, -1
]

Rubi steps

\begin{align*} \int (d x)^{-1+n} \log ^2\left (c x^n\right ) \, dx &=\frac{(d x)^n \log ^2\left (c x^n\right )}{d n}-2 \int (d x)^{-1+n} \log \left (c x^n\right ) \, dx\\ &=\frac{2 (d x)^n}{d n}-\frac{2 (d x)^n \log \left (c x^n\right )}{d n}+\frac{(d x)^n \log ^2\left (c x^n\right )}{d n}\\ \end{align*}

Mathematica [A]  time = 0.0056123, size = 30, normalized size = 0.57 \[ \frac{(d x)^n \left (\log ^2\left (c x^n\right )-2 \log \left (c x^n\right )+2\right )}{d n} \]

Antiderivative was successfully verified.

[In]

Integrate[(d*x)^(-1 + n)*Log[c*x^n]^2,x]

[Out]

((d*x)^n*(2 - 2*Log[c*x^n] + Log[c*x^n]^2))/(d*n)

________________________________________________________________________________________

Maple [C]  time = 0.121, size = 750, normalized size = 14.2 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((d*x)^(-1+n)*ln(c*x^n)^2,x)

[Out]

1/n*x*exp(1/2*(-1+n)*(-I*csgn(I*d*x)^3*Pi+I*csgn(I*d*x)^2*csgn(I*d)*Pi+I*csgn(I*d*x)^2*csgn(I*x)*Pi-I*csgn(I*d
*x)*csgn(I*d)*csgn(I*x)*Pi+2*ln(x)+2*ln(d)))*ln(x^n)^2+(I*Pi*csgn(I*x^n)*csgn(I*c*x^n)^2-I*Pi*csgn(I*x^n)*csgn
(I*c*x^n)*csgn(I*c)-I*Pi*csgn(I*c*x^n)^3+I*Pi*csgn(I*c*x^n)^2*csgn(I*c)+2*ln(c)-2)/n*x*exp(1/2*(-1+n)*(-I*csgn
(I*d*x)^3*Pi+I*csgn(I*d*x)^2*csgn(I*d)*Pi+I*csgn(I*d*x)^2*csgn(I*x)*Pi-I*csgn(I*d*x)*csgn(I*d)*csgn(I*x)*Pi+2*
ln(x)+2*ln(d)))*ln(x^n)+1/4*(-Pi^2*csgn(I*x^n)^2*csgn(I*c*x^n)^4+2*Pi^2*csgn(I*x^n)^2*csgn(I*c*x^n)^3*csgn(I*c
)-Pi^2*csgn(I*x^n)^2*csgn(I*c*x^n)^2*csgn(I*c)^2+2*Pi^2*csgn(I*x^n)*csgn(I*c*x^n)^5-4*Pi^2*csgn(I*x^n)*csgn(I*
c*x^n)^4*csgn(I*c)+2*Pi^2*csgn(I*x^n)*csgn(I*c*x^n)^3*csgn(I*c)^2-Pi^2*csgn(I*c*x^n)^6+2*Pi^2*csgn(I*c*x^n)^5*
csgn(I*c)-Pi^2*csgn(I*c*x^n)^4*csgn(I*c)^2-4*I*Pi*csgn(I*c*x^n)^2*csgn(I*c)+4*I*ln(c)*Pi*csgn(I*c*x^n)^2*csgn(
I*c)-4*I*Pi*csgn(I*x^n)*csgn(I*c*x^n)^2+4*I*Pi*csgn(I*c*x^n)^3+4*I*ln(c)*Pi*csgn(I*x^n)*csgn(I*c*x^n)^2-4*I*ln
(c)*Pi*csgn(I*x^n)*csgn(I*c*x^n)*csgn(I*c)-4*I*ln(c)*Pi*csgn(I*c*x^n)^3+4*I*Pi*csgn(I*x^n)*csgn(I*c*x^n)*csgn(
I*c)+4*ln(c)^2-8*ln(c)+8)/n*x*exp(1/2*(-1+n)*(-I*csgn(I*d*x)^3*Pi+I*csgn(I*d*x)^2*csgn(I*d)*Pi+I*csgn(I*d*x)^2
*csgn(I*x)*Pi-I*csgn(I*d*x)*csgn(I*d)*csgn(I*x)*Pi+2*ln(x)+2*ln(d)))

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x)^(-1+n)*log(c*x^n)^2,x, algorithm="maxima")

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [A]  time = 1.02732, size = 113, normalized size = 2.13 \begin{align*} \frac{{\left (n^{2} \log \left (x\right )^{2} + \log \left (c\right )^{2} + 2 \,{\left (n \log \left (c\right ) - n\right )} \log \left (x\right ) - 2 \, \log \left (c\right ) + 2\right )} d^{n - 1} x^{n}}{n} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x)^(-1+n)*log(c*x^n)^2,x, algorithm="fricas")

[Out]

(n^2*log(x)^2 + log(c)^2 + 2*(n*log(c) - n)*log(x) - 2*log(c) + 2)*d^(n - 1)*x^n/n

________________________________________________________________________________________

Sympy [A]  time = 113.492, size = 163, normalized size = 3.08 \begin{align*} \begin{cases} \tilde{\infty } x \log{\left (c \right )}^{2} & \text{for}\: d = 0 \wedge n = 0 \\\frac{\log{\left (c \right )}^{2} \log{\left (x \right )}}{d} & \text{for}\: n = 0 \\0^{n - 1} \left (n^{2} x \log{\left (x \right )}^{2} - 2 n^{2} x \log{\left (x \right )} + 2 n^{2} x + 2 n x \log{\left (c \right )} \log{\left (x \right )} - 2 n x \log{\left (c \right )} + x \log{\left (c \right )}^{2}\right ) & \text{for}\: d = 0 \\\frac{d^{n} n x^{n} \log{\left (x \right )}^{2}}{d} + \frac{2 d^{n} x^{n} \log{\left (c \right )} \log{\left (x \right )}}{d} - \frac{2 d^{n} x^{n} \log{\left (x \right )}}{d} + \frac{d^{n} x^{n} \log{\left (c \right )}^{2}}{d n} - \frac{2 d^{n} x^{n} \log{\left (c \right )}}{d n} + \frac{2 d^{n} x^{n}}{d n} & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x)**(-1+n)*ln(c*x**n)**2,x)

[Out]

Piecewise((zoo*x*log(c)**2, Eq(d, 0) & Eq(n, 0)), (log(c)**2*log(x)/d, Eq(n, 0)), (0**(n - 1)*(n**2*x*log(x)**
2 - 2*n**2*x*log(x) + 2*n**2*x + 2*n*x*log(c)*log(x) - 2*n*x*log(c) + x*log(c)**2), Eq(d, 0)), (d**n*n*x**n*lo
g(x)**2/d + 2*d**n*x**n*log(c)*log(x)/d - 2*d**n*x**n*log(x)/d + d**n*x**n*log(c)**2/(d*n) - 2*d**n*x**n*log(c
)/(d*n) + 2*d**n*x**n/(d*n), True))

________________________________________________________________________________________

Giac [A]  time = 1.2535, size = 123, normalized size = 2.32 \begin{align*} \frac{d^{n} n x^{n} \log \left (x\right )^{2}}{d} + \frac{2 \, d^{n} x^{n} \log \left (c\right ) \log \left (x\right )}{d} + \frac{d^{n} x^{n} \log \left (c\right )^{2}}{d n} - \frac{2 \, d^{n} x^{n} \log \left (x\right )}{d} - \frac{2 \, d^{n} x^{n} \log \left (c\right )}{d n} + \frac{2 \, d^{n} x^{n}}{d n} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x)^(-1+n)*log(c*x^n)^2,x, algorithm="giac")

[Out]

d^n*n*x^n*log(x)^2/d + 2*d^n*x^n*log(c)*log(x)/d + d^n*x^n*log(c)^2/(d*n) - 2*d^n*x^n*log(x)/d - 2*d^n*x^n*log
(c)/(d*n) + 2*d^n*x^n/(d*n)